package com.ytjj.qmyx.supplychain.mapper;

import com.ytjj.qmyx.supplychain.common.model.request.YxAssignFreight;
import com.ytjj.qmyx.supplychain.common.model.request.YxAstrictRegion;
import com.ytjj.qmyx.supplychain.common.model.request.YxFreightTemplate;
import com.ytjj.qmyx.supplychain.common.model.response.ProductDataResponse;
import com.ytjj.qmyx.supplychain.common.model.response.YxFreightTemplateResponse;
import org.apache.ibatis.annotations.Param;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;

/**
 *
 */
public interface FreightTemplateDao  extends Mapper<YxFreightTemplate> {

    /**
     * 条件查询运费模板
     * @param templateName
     * @return
     */
    List<YxFreightTemplateResponse> selectFreightTemplatePage(@Param("templateName") String templateName,@Param("ids") Integer ids);

    /**
     * 加模板使用量
     * @param id
     * @return
     */
    Integer addSYL(Integer quantify,Integer id);

    /**
     * 查询运费模板
     * @return
     */
    Integer selectFreightTemplates();

    /**
     * 查询运费模板
     * @return
     */
    Integer selectFreightTemplatess(@Param("templateName") String templateName,@Param("bankerId")Integer bankerId);

    /**
     * 新增运费模板主表
     * @param yxFreightTemplate
     * @return
     */
    Integer insertFreightTemplate(YxFreightTemplate yxFreightTemplate);

    /**
     * 新增指定运费
     * @param yxAssignFreightList
     * @param id
     * @return
     */
    Integer insertAssignFreightList(@Param("yxAssignFreightList") List<YxAssignFreight> yxAssignFreightList, @Param("id") Integer id);

    /**
     * 新增限制下单区域
     * @param yxAstrictRegion
     * @param id
     * @return
     */
    Integer insertAstrictRegion(@Param("yxAstrictRegion") YxAstrictRegion yxAstrictRegion, @Param("id") Integer id);

    /**
     * 查看运费模板详情
     * @param id
     * @return
     */
    YxFreightTemplateResponse selectFreightTemplateResponse(@Param("id") Integer id);

    /**
     * 删除运费模板消息
     * @param id
     * @return
     */
    Integer deleteFreightTemplate(@Param("id") Integer id);

    /**
     * 删除指定运费
     * 根据运费模板id
     * @param id
     * @return
     */
    Integer deleteAssignFreightList(@Param("id") Integer id);

    /**
     * 删除限制下单区域
     * 根据运费模板id
     * @param id
     * @return
     */
    Integer deleteAstrictRegionList(@Param("id") Integer id);

    /**
     * 删除指定运费
     * 根据自身id
     * @param id
     * @return
     */
    Integer deleteAssignFreight(@Param("id") Integer id);

    /**
     * 删除限制下单区域
     * 根据自身id
     * @param id
     * @return
     */
    Integer deleteAstrictRegion(@Param("id") Integer id);

    /**
     * 修改指定运费
     * 地区
     * @param yxAssignFreight
     * @return
     */
    Integer updataAssignFreight(@Param("yxAssignFreight") YxAssignFreight yxAssignFreight);

    /**
     * 修改限制下单区域
     * 地区
     * @param yxAstrictRegion
     * @return
     */
    Integer updataAstrictRegion(@Param("yxAstrictRegion") YxAstrictRegion yxAstrictRegion);


    /**
     * 修改运费模板
     * 地区
     * @param yxFreightTemplate
     * @return
     */
    Integer updataFreightTemplate(@Param("yxFreightTemplate") YxFreightTemplate yxFreightTemplate);

    /**
     * 修改默认
     * @return
     */
    Integer updataDefaults();

    /**
     * 修改默认
     */
    Integer updataDefault(Integer id);

    List<ProductDataResponse> queryProductDataResponse(Integer id);

    List<YxAssignFreight> queryYxAssignFreightByFreightId(Integer id);
}
